﻿using System.Collections.Generic;
using System.Linq;
using HappyBa.Core.Interfaces;

namespace HappyBa.Core.Statistics
{
    class StatisticsFacade : IStatisticsFacade
    {
        private readonly IList<IStatisticsCalculator> calculators;
        public StatisticsFacade(IList<IStatisticsCalculator> calculators)
        {
            this.calculators = calculators;
        }

        public IEnumerable<string> Calculate(StatisticsContext context)
        {
            return calculators.SelectMany(x => x.Calculate(context).Select(i=> x.GetType().Name + ": " + i));
        }
    }
}
